﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Collections;

namespace PeaceBlogData
{
    public static class PageHelper
    {
        public static IEnumerable<T> Page<T>(this IEnumerable<T> data, int pageSize, int page)
        {
            return data.Skip(page * pageSize).Take(pageSize);
        }

        public static IQueryable<T> Page<T>(this IQueryable<T> data, int pageSize, int page)
        {
            return data.Skip(page * pageSize).Take(pageSize);
        }
    }
}
